Skip to content

feat: server calculations from DateTime deltas when UseOneMinuteIntervals on (Phase 2)#1542

Merged
renemadsen merged 1 commit into
stablefrom
feat/use-one-minute-intervals-phase-2-calc-from-seconds
May 2, 2026
Merged

feat: server calculations from DateTime deltas when UseOneMinuteIntervals on (Phase 2)#1542
renemadsen merged 1 commit into
stablefrom
feat/use-one-minute-intervals-phase-2-calc-from-seconds

Conversation

@renemadsen
Copy link
Copy Markdown
Member

Summary

What changed

Two new helpers in PlanRegistrationHelper:

  • ComputeNettoSecondsFromDateTimeShifts(PlanRegistration) — sums (Stop_n_StoppedAt - Start_n_StartedAt).TotalSeconds minus pause seconds across shifts 1..5; falls back to legacy 5-min tick math for shifts without DateTime stamps.
  • ApplyNettoFlexChainSecondPrecision(PlanRegistration, int sumFlexStartInSeconds, bool hasPreTimePlanning) — writes NettoHoursInSeconds, FlexInSeconds, SumFlexStart/EndInSeconds, and back-derives the doubles via /3600.0. Mirrors the flag-off override semantics sign-for-sign.

Forks the flex/netto compute at every site:

  • PlanRegistrationHelper.UpdatePlanRegistrationsInPeriod — 4 SumFlex chain blocks
  • PlanRegistrationHelper.UpdatePlanRegistration — same chain
  • TimePlanningWorkingHoursService.UpdateWorkingHour (1-param personal) — CREATE + UPDATE branches
  • TimePlanningWorkingHoursService.UpdateWorkingHour (3-param kiosk) — CREATE + UPDATE branches
  • TimePlanningWorkingHoursService.Index — adds *InSeconds to the model and forks the SumFlex re-accumulation loop
  • TimePlanningPlanningService.Update — main compute + replay-forward loop
  • TimePlanningPlanningService.UpdateByCurrentUserNam — main compute + replay-forward loop

Tests added

8 new tests in PlanRegistrationHelperTests.cs:

  1. NettoHours_FlagOn_DerivedFromDateTimeDeltasInSeconds
  2. NettoHours_FlagOn_PauseDateTimeBeatsPauseId
  3. FlexAndSumFlex_FlagOn_DerivedFromInSecondsChain
  4. SumFlex_FlagOn_NoPreceding_StartsAtZero
  5. Flex_FlagOn_OverrideActive_UsesOverrideForChain
  6. PaiedOutFlex_FlagOn_DerivedFromInSeconds
  7. NettoHours_FlagOff_NewHelperNotInvoked (flag-off regression guard)
  8. Index_FlagOn_DerivedFieldsConsistent ([Ignore]'d, fixture carve-out per Phases 0/1 pattern)

No edits to existing tests.

Test plan

  • CI: pn-server-test green
  • CI: pn-playwright-test (a) green
  • CI: pn-playwright-test (b) green
  • CI: pn-client-test green
  • No proto changes
  • No migration changes
  • Flag-off path byte-identical (existing tests prove it)

Plan

/home/rene/.claude/plans/parallel-twirling-balloon.md

🤖 Generated with Claude Code

…en UseOneMinuteIntervals on (Phase 2)

Phase 2 of the UseOneMinuteIntervals second-precision rollout.
When the flag is on, server-side calculations of NettoHours, Flex,
SumFlexStart/End, and PaiedOutFlex use DateTime deltas (precise to
the second) and write to the *InSeconds int columns as the
authoritative source. Legacy double hour fields are derived from
the *InSeconds primary via /3600.0.

The DateTime fields and *InSeconds columns already exist (no
migration needed). The flag-off path is byte-identical to before
- existing tests pass unchanged.

Adds 8 regression tests covering: flag-on derives from DateTime,
flag-on prefers DateTime pause stamp over legacy Pause1Id, the
SumFlex chain stays consistent, no-preceding-day case starts at 0,
override semantics use the override for flex but actual for netto,
PaiedOutFlex follows the same /3600.0 pattern, and a flag-off
guard plus an Index integration carve-out test (per the same
[Ignore] pattern used in Phases 0 and 1).

Plan: /home/rene/.claude/plans/parallel-twirling-balloon.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@renemadsen renemadsen merged commit e9ab559 into stable May 2, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant